package com.wind.ipagent.utils;

import org.apache.commons.lang.StringUtils;

import java.io.UnsupportedEncodingException;

public class StringHandleUtils {
  public static String captureName(String name) {
    name = name.substring(0, 1).toUpperCase() + name.substring(1);
    return  name;

  }

  public static String handerStringToLong(String name) {
    if(StringUtils.isEmpty(name)){
      return name;
    }
    String result="";
    int num=0;
    try {
    for(int i=0;i<name.length();i++){
        num += (name.charAt(i)+"").getBytes("utf-8").length;
      if(num>24){
        break;
      }
      result+=name.charAt(i)+"";
    }
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }

    return result;

  }

}
